﻿using LxCFD;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LxCFD
{
    public class ScalarHeadBase : IInitializable, IConnectivityAnalyzableZone
    {
        protected volatile bool IsInitialized = false;

        public FvZoneBase Zone;
        protected FvFace[] Faces;
        protected FvCell[] Cells;
        protected IndexNumber InnerIndex;
        protected IndexNumber TotalIndex;
        public double[] x_Common;
        public double[] b_FaceCommon;//计算b的时候，O加N减
        public virtual void CheckCreate(FvZoneBase zone)
        {
            this.Zone = zone;
            this.Faces = zone.Faces;
            this.Cells = zone.Cells;
            this.InnerIndex = zone.InnerIndex;
            this.TotalIndex = zone.TotalIndex;
            this.x_Common = zone.CellCommonArray;
            this.b_FaceCommon = zone.FaceCommonArray;
        }
        protected void Set_bFaceCommon_0(IndexNumber indexNumber, int taskIndex)
        {
            indexNumber.FaceIDs.GetSeg(out int i1, out int endp1, taskIndex);
            for (; i1 < endp1; i1++)
            {
                b_FaceCommon[i1] = 0;
            }
        }
        public int GetZoneID()
        {
            return Zone.ID;
        }
        public bool GetIsInitialized()
        {
            return IsInitialized;
        }
        public void SetIsInitialized(bool isInitialized)
        {
            IsInitialized = isInitialized;
        }

        public virtual void Initialize()
        {
            throw new NotImplementedException();
        }
    }
}
